package com.kfdx.dc.service.impl;

import java.util.List;
        import com.kfdx.dc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.kfdx.dc.mapper.DcOrderDetailMapper;
import com.kfdx.dc.domain.DcOrderDetail;
import com.kfdx.dc.service.IDcOrderDetailService;

/**
 * 订单明细Service业务层处理
 *
 * @author cx
 * @date 2024-09-23
 */
@Service
public class DcOrderDetailServiceImpl extends ServiceImpl<DcOrderDetailMapper, DcOrderDetail> implements IDcOrderDetailService
{
    @Autowired
    private DcOrderDetailMapper dcOrderDetailMapper;

    /**
     * 查询订单明细
     *
     * @param orderId 订单明细主键
     * @return 订单明细
     */
    @Override
    public DcOrderDetail selectDcOrderDetailByOrderId(Long orderId)
    {
        return dcOrderDetailMapper.selectDcOrderDetailByOrderId(orderId);
    }

    /**
     * 查询订单明细列表
     *
     * @param dcOrderDetail 订单明细
     * @return 订单明细
     */
    @Override
    public List<DcOrderDetail> selectDcOrderDetailList(DcOrderDetail dcOrderDetail)
    {
        return dcOrderDetailMapper.selectDcOrderDetailList(dcOrderDetail);
    }

    /**
     * 新增订单明细
     *
     * @param dcOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int insertDcOrderDetail(DcOrderDetail dcOrderDetail)
    {
                dcOrderDetail.setCreateTime(DateUtils.getNowDate());
            return dcOrderDetailMapper.insert(dcOrderDetail);
    }

    /**
     * 修改订单明细
     *
     * @param dcOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int updateDcOrderDetail(DcOrderDetail dcOrderDetail)
    {
                dcOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return dcOrderDetailMapper.updateById(dcOrderDetail);
    }

    /**
     * 批量删除订单明细
     *
     * @param orderIds 需要删除的订单明细主键
     * @return 结果
     */
    @Override
    public int deleteDcOrderDetailByOrderIds(Long[] orderIds)
    {
        return dcOrderDetailMapper.deleteDcOrderDetailByOrderIds(orderIds);
    }

    /**
     * 删除订单明细信息
     *
     * @param orderId 订单明细主键
     * @return 结果
     */
    @Override
    public int deleteDcOrderDetailByOrderId(Long orderId)
    {
        return dcOrderDetailMapper.deleteDcOrderDetailByOrderId(orderId);
    }
}
